package com.cloud.config;


import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.SetOperations;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.data.redis.core.ZSetOperations;

import javax.annotation.Resource;


/**
  * @Description   基于注解的调用可以注解内实现正则匹配规则及复杂的多条件判断。
  *                基于Operations的调用方法Spring data已进行二次封装
  * @Author wangjian (jian.wang@bertelsmann.com.cn)
  * @Date   2017/1/12 16:58
  */
public abstract class AbstractBaseDataManager {


    /**
     * cache switch
     */
//    @Value("${cn.sephora.server.enablecache}")
    private Boolean isEnableCache = true;


    /**
     * 简单字符串类型操作
     */
    @Resource(name = "redisTemplate")
    protected ValueOperations valOps;

    /**
     * Hash类型操作
     */
    @Resource(name = "redisTemplate")
    protected HashOperations hashOps;

    /**
     * Set类型操作
     */
    @Resource(name = "redisTemplate")
    protected SetOperations setOps;

    /**
     * List类型操作
     */
    @Resource(name = "redisTemplate")
    protected ListOperations listOps;

    /**
     * Sorted Set类型操作
     */
    @Resource(name = "redisTemplate")
    protected ZSetOperations zSetOps;

    @Resource(name = "redisTemplate")
    protected ValueOperations valueOps;


    protected Boolean getEnableCache() {
        return isEnableCache;
    }

    protected void setEnableCache(Boolean enableCache) {
        isEnableCache = enableCache;
    }

}
